package TestJava.WordCount;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class h_Driver {
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        Job job = Job.getInstance(new Configuration());

        job.setJarByClass(h_Mapper.class);

        job.setMapperClass(h_Mapper.class);

        job.setReducerClass(h_Reducer.class);

        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(IntWritable.class);

        job.setOutputKeyClass(Text.class);

        FileInputFormat.setInputPaths(job, new Path("D:\\243201108\\Project\\Java\\JavaProject\\src\\Out\\word.txt"));

        FileOutputFormat.setOutputPath(job, new Path("D:\\243201108\\Project\\Java\\JavaProject\\src\\Out\\test"));

        job.waitForCompletion(true);
    }
}
